<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Icarous: /home/research133/Software/Icarous2/cFS/apps/APFunctionsLib/fsw/platform_inc/APFunctions.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Icarous
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_c1698e121239b1aba7f6e782e4514e49.html">cFS</a></li><li class="navelem"><a class="el" href="dir_7ee4ce95da95d11e80a01c5101ed8d14.html">apps</a></li><li class="navelem"><a class="el" href="dir_317d6ca852cded2ae8f333c1c6fa2642.html">APFunctionsLib</a></li><li class="navelem"><a class="el" href="dir_a6b1ea7cf31e95aa10ce6ceceb09375b.html">fsw</a></li><li class="navelem"><a class="el" href="dir_59489f6968c2806619fd1c8cf7bd641b.html">platform_inc</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">APFunctions.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">// Created by Swee Balachandran on 11/28/17.</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;</div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#ifndef APFUNCTIONS_H</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#define APFUNCTIONS_H</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &quot;cfe.h&quot;</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &quot;msgids/msgids.h&quot;</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &quot;common_defs.h&quot;</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;</div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#define InitCmdMsg(cmd)\</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">ArgsCmd_t cmd; \</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">CFE_SB_InitMsg(&amp;cmd,AP_COMMANDS_MID,sizeof(ArgsCmd_t),TRUE);</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#define InitTrafficServiceMsg(msg)\</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">service_t msg; \</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">CFE_SB_InitMsg(&amp;msg,SERVICE_TRAFFIC_MID,sizeof(service_t),TRUE);\</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">msg.id = (rand() + rand());</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#define InitTrajectoryServiceMsg(msg)\</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor">service_t msg; \</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">CFE_SB_InitMsg(&amp;msg,SERVICE_TRAJECTORY_MID,sizeof(service_t),TRUE);\</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">msg.id = (rand() + rand());</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#define InitGeofenceServiceMsg(msg)\</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">service_t msg; \</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">CFE_SB_InitMsg(&amp;msg,SERVICE_GEOFENCE_MID,sizeof(service_t),TRUE);\</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">msg.id = (rand() + rand());</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;int32 APFunctionsLibInit(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="keywordtype">void</span> SetMode(icarous_control_mode_t mode);</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="keywordtype">void</span> ArmThrottles(uint8_t c);</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="keywordtype">void</span> SetNextMissionItem(<span class="keywordtype">int</span> nextWP);</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="keywordtype">void</span> Takeoff(<span class="keywordtype">float</span> alt);</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="keywordtype">void</span> Land();</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="keywordtype">void</span> SetYaw(uint8_t relative,<span class="keywordtype">double</span> heading);</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="keywordtype">void</span> SetGPSPosition(<span class="keywordtype">double</span> lat,<span class="keywordtype">double</span> lon,<span class="keywordtype">double</span> alt);</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="keywordtype">void</span> SetVelocity(<span class="keywordtype">double</span> Vn, <span class="keywordtype">double</span> Ve, <span class="keywordtype">double</span> Vu);</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="keywordtype">void</span> SetSpeed(<span class="keywordtype">float</span> speed);</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment">// helper functions to request services from geofence app</span></div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="comment"></span><span class="keywordtype">int</span> ServiceFence_GetFenceViolation(<span class="keywordtype">double</span>* <a class="code" href="ardupilot_8h.html#a97f6f07d9b99c3e3d789183a9064a7da">position</a>,<span class="keywordtype">double</span>* velocity);</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="keywordtype">int</span> ServiceFence_GetWPFeasibility(<span class="keywordtype">double</span>* positionA,<span class="keywordtype">double</span>* positionB);</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="keywordtype">int</span> ServiceFence_GetRecoveryPosition(<span class="keywordtype">double</span>* <a class="code" href="ardupilot_8h.html#a97f6f07d9b99c3e3d789183a9064a7da">position</a>);</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="comment">// helper function to request services from traffic app given current position and velocity of ownship.</span></div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="comment"></span><span class="keywordtype">int</span> ServiceTraffic_GetTrafficConflict(<span class="keywordtype">bool</span> bands,<span class="keywordtype">double</span>* <a class="code" href="ardupilot_8h.html#a97f6f07d9b99c3e3d789183a9064a7da">position</a>,<span class="keywordtype">double</span>* velocity);</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="keywordtype">int</span> ServiceTraffic_GetSafe2Turn(<span class="keywordtype">double</span>* <a class="code" href="ardupilot_8h.html#a97f6f07d9b99c3e3d789183a9064a7da">position</a>,<span class="keywordtype">double</span>* velocity,<span class="keywordtype">double</span> headingA,<span class="keywordtype">double</span> headingB);</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;<span class="comment">// helper functions to request services from trajectory app</span></div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<span class="keywordtype">int</span> ServiceTrajectory_GetWaypoint(<span class="keywordtype">char</span>* planID,<span class="keywordtype">int</span> index);</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;<span class="keywordtype">int</span> ServiceTrajectory_GetTotalWaypoints(<span class="keywordtype">char</span>* planID);</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;<span class="keywordtype">int</span> ServiceTrajectory_GetNewPath(<span class="keywordtype">char</span>* planID,<span class="keywordtype">char</span>* <a class="code" href="group__TRAJECTORY__MESSAGES.html#ga8a0fd7a8363e41d8c12a90716f4f500f">algorithm</a>,<span class="keywordtype">double</span>* positionA,<span class="keywordtype">double</span>* velocity,<span class="keywordtype">double</span>* positionB);</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="keywordtype">int</span> ServiceTrajectory_GetXTrackDeviation(<span class="keywordtype">char</span>* planID,<span class="keywordtype">int</span> leg,<span class="keywordtype">double</span>* <a class="code" href="ardupilot_8h.html#a97f6f07d9b99c3e3d789183a9064a7da">position</a>);</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;<span class="keywordtype">int</span> ServiceTrajectory_GetDistance(<span class="keywordtype">double</span>* positionA,<span class="keywordtype">double</span>* positionB);</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;<span class="keywordtype">int</span> ServiceTrajectory_GetExitPoint(<span class="keywordtype">char</span>* planID,<span class="keywordtype">double</span>* <a class="code" href="ardupilot_8h.html#a97f6f07d9b99c3e3d789183a9064a7da">position</a>,<span class="keywordtype">int</span> nextWP);</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;<span class="keywordtype">int</span> ServiceTrajectory_GetInterceptHeading(<span class="keywordtype">char</span>* planID,<span class="keywordtype">int</span> nextWP,<span class="keywordtype">double</span>* <a class="code" href="ardupilot_8h.html#a97f6f07d9b99c3e3d789183a9064a7da">position</a>);</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;<span class="keywordtype">int</span> ServiceTrajectory_GetInterceptManeuver(<span class="keywordtype">char</span>* planID,<span class="keywordtype">int</span> nextWP,<span class="keywordtype">double</span>* <a class="code" href="ardupilot_8h.html#a97f6f07d9b99c3e3d789183a9064a7da">position</a>);</div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;<span class="keywordtype">int</span> ServiceTrajectory_GetManeuverHeading(<span class="keywordtype">double</span>* positionA,<span class="keywordtype">double</span>* positionB);</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;<span class="comment">// helper functions to decode service response</span></div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;<span class="comment"></span><span class="keywordtype">void</span> ServiceFence_DecodeFenceViolation(service_t* msg,<span class="keywordtype">bool</span>* output);</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;</div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;<span class="keywordtype">void</span> ServiceFence_DecodeWPFeasibility(service_t* msg,<span class="keywordtype">bool</span>* output);</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;<span class="keywordtype">void</span> ServiceFence_DecodeRecoveryPosition(service_t* msg,<span class="keywordtype">double</span>* output);</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;</div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;<span class="keywordtype">void</span> ServiceTraffic_DecodeTrafficConflict(service_t* msg,<span class="keywordtype">bool</span>* conflict,<span class="keywordtype">double</span>* output);</div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;<span class="keywordtype">void</span> ServiceTraffic_DecodeSafe2Turn(service_t* msg,<span class="keywordtype">bool</span>* output);</div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;</div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;<span class="keywordtype">void</span> ServiceTrajectory_DecodeWaypoint(service_t* msg,<span class="keywordtype">double</span>* output);</div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;</div><div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;<span class="keywordtype">void</span> ServiceTrajectory_DecodeTotalWaypoints(service_t* msg,<span class="keywordtype">int</span>* output);</div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;</div><div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;<span class="keywordtype">void</span> ServiceTrajectory_DecodeNewPath(service_t* msg,<span class="keywordtype">int</span>* output);</div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;</div><div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;<span class="keywordtype">void</span> ServiceTrajectory_DecodeXTrackDeviation(service_t* msg,<span class="keywordtype">double</span>* output);</div><div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;</div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;<span class="keywordtype">void</span> ServiceTrajectory_DecodeDistance(service_t* msg,<span class="keywordtype">double</span>* output);</div><div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;</div><div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;<span class="keywordtype">void</span> ServiceTrajectory_DecodeExitPoint(service_t* msg,<span class="keywordtype">double</span>* output);</div><div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;</div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;<span class="keywordtype">void</span> ServiceTrajectory_DecodeInterceptHeading(service_t* msg,<span class="keywordtype">double</span>* output);</div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;</div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;<span class="keywordtype">void</span> ServiceTrajectory_DecodeInterceptManeuver(service_t* msg,<span class="keywordtype">double</span>* output);</div><div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;<span class="keywordtype">void</span> ServiceTrajectory_DecodeManeuverHeading(service_t* msg,<span class="keywordtype">double</span>* output);</div><div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;</div><div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;<span class="preprocessor">#endif //APFUNCTIONS_H</span></div><div class="ttc" id="group__TRAJECTORY__MESSAGES_html_ga8a0fd7a8363e41d8c12a90716f4f500f"><div class="ttname"><a href="group__TRAJECTORY__MESSAGES.html#ga8a0fd7a8363e41d8c12a90716f4f500f">algorithm</a></div><div class="ttdeci">algorithm</div><div class="ttdef"><b>Definition:</b> trajectory_msg.h:22</div></div>
<div class="ttc" id="ardupilot_8h_html_a97f6f07d9b99c3e3d789183a9064a7da"><div class="ttname"><a href="ardupilot_8h.html#a97f6f07d9b99c3e3d789183a9064a7da">position</a></div><div class="ttdeci">EXTERN position_t position</div><div class="ttdoc">position message </div><div class="ttdef"><b>Definition:</b> ardupilot.h:242</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
